package demo8;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class Stack_of_Boxes {
    @Data
    @Getter@Setter
    public class Box implements Comparator<Box> {
        private int heigh;

        @Override
        public int compare(Box o1, Box o2) {
            return o1.heigh-o2.heigh;
        }
    }
    /**
     * get the qualified boxes
     *        Box[0]=new Box(1)
     *        Box[1]=new Box(1)
     */
    public void stack(ArrayList<Box> boxes){
        Collections.sort(boxes,null);
        int len=boxes.size();
        // get the heigh
        for (int i = 0; i <len ; i++) {
            boxes.get(i).getHeigh();
        }

    }
}
